﻿using System;
using System.Net.Sockets;

namespace NMemcached.Client
{
    /// <summary>
    /// Provides data for MemcachedClient connection events
    /// </summary>
    public class ConnectionEventArgs : EventArgs
    {
        /// <summary>
        /// Gets the connection for the event
        /// </summary>
        public ServerConnection Connection { get; private set; }
        /// <summary>
        /// Gets the socket exception, if any, for the event
        /// </summary>
        public SocketException SocketException { get; private set; }

        /// <summary>
        /// Initializes a new instance of the ConnectionEventArgs class
        /// </summary>
        /// <param name="connection">The connection for the event</param>
        public ConnectionEventArgs(ServerConnection connection)
            : this(connection, null)
        {
        }

        /// <summary>
        /// Initializes a new instance of the ConnectionEventArgs class
        /// </summary>
        /// <param name="connection">The connection for the event</param>
        /// <param name="socketException">The socket exception for the event</param>
        public ConnectionEventArgs(ServerConnection connection, SocketException socketException)
            : base()
        {
            this.Connection = connection;
            this.SocketException = socketException;
        }
    }
}
